package win.zxshuo.www.controller.pages;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import win.zxshuo.www.model.CategoryModel;
import win.zxshuo.www.service.CategoryService;

import java.util.List;

@Controller
public class PageController {

    @Autowired
    CategoryService categoryService;

    @RequestMapping("/")
    public String indexController(Model model){

        // 页面必须有的
        List<CategoryModel> categories = categoryService.getAllCategories();
        model.addAttribute("categories",categories);


        return "index";
    }

}
